<!-- video-player.html -->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Video Player</title>
  <style>
    body, html {
      margin: 0;
      padding: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
    }

    video {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
  </style>
</head>
<body>
<video id="myVideo" controls autoplay muted playsinline webkit-playsinline airplay="allow"></video>

<script>
  document.addEventListener('DOMContentLoaded', function() {
    var video = document.getElementById('myVideo');
    const urlParams = new URLSearchParams(window.location.search);
    const videoSrc = urlParams.get('src') || 'https://example.com/path/to/your/video.mp4';
    video.src = videoSrc;

    // 监听播放事件
    video.addEventListener('play', function() {
      // 确保视频保持在页面内
      video.style.position = 'absolute';
      video.style.top = '0';
      video.style.left = '0';
      video.style.width = '100%';
      video.style.height = '100%';
      video.style.objectFit = 'contain';
    });

    // 防止点击视频时触发默认行为（如全屏）
    video.addEventListener('click', function(event) {
      event.preventDefault();
      if (video.paused) {
        video.play();
      } else {
        video.pause();
      }
    });

    // 尝试禁用Safari的自动全屏功能
    if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
      document.documentElement.setAttribute('playsinline', '');
    }
  });
</script>
</body>
</html>
